Skip to content

[3주차] 임현성/[feat] 팀 내 요구사항에 맞는 게시글 API 구축#99

Open
HyeonSeongIM wants to merge 1 commit intoLeets-Official:임현성/mainfrom
HyeonSeongIM:임현성/3주차

Hidden character warning

The head ref may contain hidden characters: "\uc784\ud604\uc131/3\uc8fc\ucc28"
Open

[3주차] 임현성/[feat] 팀 내 요구사항에 맞는 게시글 API 구축#99
HyeonSeongIM wants to merge 1 commit intoLeets-Official:임현성/mainfrom
HyeonSeongIM:임현성/3주차

Conversation

@HyeonSeongIM
Copy link
Copy Markdown

@HyeonSeongIM HyeonSeongIM commented Apr 7, 2026

1. 과제 요구사항 중 구현한 내용

  • 게시글 목록 조회
  • 특정 게시글 조회
  • 게시글 생성
  • 게시글 수정
  • 게시글 삭제
  • 예외 처리

2. 핵심 변경 사항

스크린샷 2026-04-07 오후 12 32 15
  • dto 디렉토리를 request와 response로 분리
  • service 디렉토리를 단순 impl로 구현하지 않고 각 역할에 맞는 클래스로 분리
  • error 응답 타입과 response를 support 디렉토리에 두어 관리

3. 실행 및 검증 결과

  • 실행 결과:
  • GET 전체 게시글 받아오기
스크린샷 2026-04-06 오후 7 18 23
  • POST 게시글 생성
스크린샷 2026-04-06 오후 7 18 17
  • GET 특정 게시글 조회
스크린샷 2026-04-06 오후 7 18 30
  • PUT 게시글 수정
스크린샷 2026-04-06 오후 7 18 58
  • DELETE 게시글 삭제
스크린샷 2026-04-06 오후 7 19 09
  • GET 게시글이 존재하지 않을 때 예외처리
스크린샷 2026-04-06 오후 7 47 26
  • GET 특정 게시글이 존재하지 않을 때 예외처리
스크린샷 2026-04-06 오후 7 47 29
  • POST 제목 및 내용이 10자 이상 되지 않을 때 예외처리
스크린샷 2026-04-06 오후 7 49 21

4. 완료 사항

  1. 게시글 CRUD
  2. 예외처리
  3. API 생성

5. 추가 사항

  • 관련 이슈: closed #이슈번호

제출 체크리스트

  • PR 제목이 규칙에 맞다
  • base가 {이름}/main 브랜치다
  • compare가 {이름}/{숫자}주차 브랜치다
  • 프로젝트가 정상 실행된다
  • 본인을 Assignee로 지정했다
  • 파트 담당 Reviewer를 지정했다
  • 리뷰 피드백을 반영한 뒤 머지/PR close를 진행한다

Reviewer 참고

@HyeonSeongIM HyeonSeongIM self-assigned this Apr 7, 2026
@HyeonSeongIM HyeonSeongIM requested a review from a team April 7, 2026 03:38
public enum ResultType {

SUCCESS, ERROR

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

코드 작성하시느라 수고 많으셨습니다.
enum으로 ResultType을 정의해서 숫자 상수 대신 명확한 타입으로 상태를 표현한점이 좋은 것 같습니다.

Comment on lines +23 to +25
if (posts.isEmpty()) {
throw new PostException(ErrorType.NOT_EXIST_POST);
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

게시글이 없는 경우도 예외 처리로 하신 것 같은데, 서비스를 시작한 초기 상태처럼 게시글이 아예 없는 경우에도 예외가 발생하게 되는 건지 궁금합니다!

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

서비스 역할별 파일 구조가 잘 분리되어 있는 것 같아요!! 배워갑니다!~!

@Transactional
public Post update (Long postId, Post post) {

Post savedPost = postRepository.findById(postId).orElseThrow(RuntimeException::new);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PostFinder에서는 커스텀 예외를 사용하고 계신 것 같은데, PostManager.update()에서는 RuntimeException을 사용하신 이유가 있을까요?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

예외 핸들러가 정말 깔끔하네요! 특히 ErrorType에 따른 로그 레벨 분기는 운영 시 불필요한 노이즈를 줄여주는 세심한 설계인 것 같아 인상 깊습니다.

저도 공부하다 알게되어 한 가지 제안을 드리자면, ResponseEntity 대신 ResponseEntity>처럼 타입을 명시해보는 건 어떨까요?
현재 방식도 동작에는 문제가 없지만, Swagger 같은 문서화 도구를 사용하는 경우 응답 스펙을 자동으로 인식하지 못하는 경우가 있어서, 타입을 구체화하면 API 스펙 공유나 협업 측면에서 도움이 될 수 있을 것 같습니다!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants